﻿@model PagedData<GalleryGroup>

@{
	Layout = Carrotware.CMS.Interface.CarrotLayout.Main;
	ViewBag.Title = "Gallery Index";
}

<h3>@ViewBag.Title</h3>

<p>
	@CarrotWeb.ActionImage("CreateGallery", "Admin", null, "~/assets/admin/images/add.png", "Add Gallery", null, null)
	@Html.ActionLink("Create New", "CreateGallery")
</p>

@using (Html.BeginForm(null, null, FormMethod.Post, new { @id = "sortTable" })) {
	@Html.AntiForgeryToken()

	var grid = CarrotWeb.CarrotWebGrid<GalleryGroup>(Model);

	grid.TableAttributes = new { @class = "datatable table" };
	grid.THeadAttributes = new { @class = "tablehead" };
	grid.EmptyDataTemplate = @<text><p> <b>No records found.</b> </p></text>;
	grid.ConfigName(Html.NameFor(x => x));

	grid
	.AddColumn(new CarrotGridTemplateColumn<GalleryGroup> {
		HasHeadingText = false,
		FormatTemplate = @<text> @CarrotWeb.ActionImage("EditGallery", "Admin", new { @id = @item.GalleryID }, "~/assets/admin/images/pencil.png", @item.GalleryTitle, null, null) </text>
	})
	.AddColumn(new CarrotGridTemplateColumn<GalleryGroup> {
		HasHeadingText = false,
		FormatTemplate = @<text> @CarrotWeb.ActionImage("EditGalleryPhotos", "Admin", new { @id = @item.GalleryID }, "~/assets/admin/images/image.png", @item.GalleryTitle, null, null) </text>
	})
		.AddColumn(x => x.GalleryTitle, new CarrotGridColumn { Sortable = true });

	grid.SetupFooter("ul", new { @class = "tablepager ui-widget ui-helper-clearfix ui-widget-content ui-corner-all" }, "li", new { @class = "ui-state-default ui-state-active ui-corner-all" }, new { @class = "ui-state-default ui-corner-all" });

	@grid.Write()

}